//
//  ToolNetWorking.m
//  Cat
//
//  Created by dllo on 15/11/26.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ToolNetWorking.h"

@implementation ToolNetWorking

+ (void)ToolNetWorking:(NSString *)urlStr block:(Block)block{
    
    // 数据请求
    AFHTTPRequestOperationManager *requestManager = [AFHTTPRequestOperationManager manager];
    [requestManager GET:urlStr parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        block(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"%@", error);
    }];
}

+ (void)POSTToolNetWorking:(NSString *)urlStr body:(NSDictionary *)body block:(Block)block {
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    
    [manager POST:urlStr parameters:body success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        block(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
    }];
    
}

@end
